package com.jh.user.business;

import cn.jh.common.exception.ServiceException;
import com.jh.user.pojo.Channel;
import com.jh.user.pojo.UserAccount;
import com.jh.user.pojo.UserBalanceHistory;
import com.jh.user.pojo.UserRebateAccountFreezeHistory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface UserBalanceBusiness {


	/**查询用户的账户信息*/
	public UserAccount queryUserAccountByUserid(long userid);


	public UserAccount freezeUserAccount(UserAccount userAccount, BigDecimal amount, String addorsub, String ordercode) throws Exception;


	public UserAccount freezeUserRebateAccount(UserAccount userAccount, BigDecimal amount, String addorsub, String ordercode) throws Exception;


	/**提现冻结*/
	public UserAccount withdrawFreeAccount(long userid,  BigDecimal amount, String ordercode);

	/**分润提现冻结*/
	public UserAccount rebateFreezeAccount(long phone,  BigDecimal amount,  String ordercode);



	public UserAccount saveUserAccount(UserAccount userAccount);


	/**锁定用户的账户信息*/
	public UserAccount lockUserAccount(long userid) throws ServiceException;


	/**生成用户的交易余额变动历史*/
	public UserBalanceHistory  saveUserBalanceHistory(UserBalanceHistory balHistory);


	/**按用户的id分页查询用户的账户变更历史记录 */
	public Page<UserBalanceHistory>  queryUserBalHistoryByUserid(long userid,  Pageable pageAble);



	public UserAccount updateUserAccount(UserAccount userAccount, BigDecimal amount,  String addorsub, String ordercode) throws Exception;


	public UserAccount updateUserRebateAccount(UserAccount userAccount, BigDecimal amount,  String ordercode);

	/**按ID查询用户的日。月。总 收入***/

	public Map findSumUserBalByUserId( long userid);

	List<Channel> getChannelList(long userId, long payType, long channelId,String amountMoney,String type);

	UserAccount updateAccount(String bankCard, long userId, BigDecimal amount, BigDecimal actualAmount, String orderCode, BigDecimal balance, String addorsub) throws ServiceException;

	UserAccount addUserAccount(UserAccount userAccount,BigDecimal amount);

	UserAccount rebateWithdraw(long userId, BigDecimal rebateAmount, BigDecimal rebateBalance) throws ServiceException;

	Page<UserBalanceHistory> queryAccountHistory(long userId, Pageable pageable) throws ServiceException;

	Page<UserRebateAccountFreezeHistory> queryRebatePage(long userId, Pageable pageable) throws ServiceException;

	UserAccount refundBalannce(long userId, String orderCode) throws ServiceException;
}
